<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html><head>
<title>alloc</title>
</head><body>
<p>[<a href="mxdoc.htm">mainpage</a>]
[<a href="tags.htm">tags</a>]<br>
<h1><a name="alloc">module: alloc</a></h1><p><b>Wrappers for C memory management functions with error checking</b><p>

This module contains macros and functions that perform as wrappers
for standard C memory management functions, malloc, realloc and free.  The
wrapper functions check for incorrect use realloc and free, memory overrun
errors and double free errors.  If, at program termination, that memory has
not been properly free'd then error messages are written to stderr with the
unfreed memory allocations.  Logging of all memory management function calls
to stderr can be turned on to aid in debugging.  The wrappers can be 'turned
off' at compile time for zero overhead.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p>Part of the <a href="deds.htm">deds</a> library.<ul><li>
<a name=" define MXMODULE_ALLOC"><code># define MXMODULE_ALLOC</code></a>
<p>
<p><b>Turn on memory tracking</b><p>
If this macro is defined the functions mx_malloc, mx_realloc and mx_free
are made to keep track of memory allocated and warn from common memory allocation
mistakes.  If this symbol is not defined then mx_malloc, mx_realloc and mx_free
just pass all arguments to the corresponding stdlib malloc, realloc, and free
function.  In this case no additional memory checking is done.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
<li>
<a name=" define mx_malloc"><code># define mx_malloc</code></a>
<p>
<p><b>Replacement for stdlib malloc</b><p>
This function is a wrapper for malloc().  If MXMODULE_ALLOC is defined then
this function keeps track of memory and warns about possible memory allocation
problems.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
<li>
<a name=" define mx_realloc"><code># define mx_realloc</code></a>
<p>
<p><b>Replacement for stdlib realloc</b><p>
This function is a wrapper for realloc().  If MXMODULE_ALLOC is defined then
this function keeps track of memory and warns about possible memory allocation
problems.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
<li>
<a name=" define mx_free"><code># define mx_free</code></a>
<p>
<p><b>Replacement for stdlib free</b><p>
This function is a wrapper for free().  If MXMODULE_ALLOC is defined then
this function keeps track of memory and warns about possible memory allocation
problems.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
<li>
<a name=" define MXDEBUG_ALLOCTAG(p)"><code># define MXDEBUG_ALLOCTAG(p)</code></a>
<p>
<p><b>Tag an allocation (debug)</b><p>
This macro tags a pointer to memory with the current filename and source line.
If the pointer does not exist the the current allocation list then this macro does nothing.
If memory debugging is off (MXMODULE_ALLOC undefined or NDEBUG is defined) then
this macro compiles to nothing.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
<li>
<a name=" define MXDEBUG_ALLOCCHECK()"><code># define MXDEBUG_ALLOCCHECK()</code></a>
<p>
<p><b>Check all allocations</b><p>
This macro causes all allocations to be checked for over/under writing.
If memory debugging is off (MXMODULE_ALLOC undefined or NDEBUG is defined) then
this macro compiles to nothing.  
(<a href="../include/deds/alloc.h">../include/deds/alloc.h</a>)<p></li>
</ul><p>Generated by <a href="http://www.deleveld.dds.nl/mxdoc/index.htm">MXDOC</a> 2.2 on Sun Feb  4 15:16:26 2007


</body></html>
